package DesignPaternObserver;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.Observable;
import java.util.Observer;

public class Parti implements Observer {
	
	private int id;
    private String nameParti;
    private String infos;

        public Parti(int id, String nameParti, String infos) {
		super();
		this.id = id;
		this.nameParti = nameParti;
		this.infos = infos;
	}

      
        @Override
        public void update(Observable arg0, Object arg1) {
                if (arg0 instanceof Gouvernement) {
                        Calendar calendar=new GregorianCalendar(Locale.FRANCE);
                        Date date=calendar.getTime();
                        setInfos("Changement de gouvernement le "+new SimpleDateFormat().format(date));
                }
               
        }


        public int getId() {
                return id;
        }

        public void setId(int id) {
                this.id = id;
        }

        public String getNameParti() {
                return nameParti;
        }

        public void setNameParti(String nameParti) {
                this.nameParti = nameParti;
        }
        public String getInfos() {
            return infos;
    }

    public void setInfos(String infos) {
            this.infos = infos;
    }
       
}
